package com.util.cdb.controller;

import com.util.cdb.bean.Result;
import com.util.cdb.bean.vo.yhml.YhmlCreateVO;
import com.util.cdb.service.YhmlService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @description: 用户目录管理
 * @author: fengfazheng
 * @create: 2022-01-02 20:55
 **/
@RestController
@RequestMapping("/yhml")
@Api(value = "/yhml", tags = "目录管理")
public class YhmlContrller {
    @Autowired
    private YhmlService yhmlService;

    @PostMapping("/create")
    @ApiOperation(value = "新增目录", httpMethod = "POST", notes = "新增目录")
    public Result create(@RequestBody YhmlCreateVO yhmlCreateVO) {
        yhmlService.createYhml(yhmlCreateVO);
        return Result.resultOk();
    }

    @GetMapping("/getAll")
    @ApiOperation(value = "获取目录", httpMethod = "GET", notes = "获取目录")
    public Result getAll(@RequestParam String id) {
        return Result.resultOk(yhmlService.getAll(id));
    }
}
